
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="java.util.*"%>
<%@ page import="wish.*"%>
<%@ page import="member.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/Dmyna/head.jsp"%>
<%@ include file="/Dmyna/myMenu.jsp"%>
<%
	String SSMBNO = (String)session.getAttribute("SESSION_MB_NO");
	int ssmbno = Integer.parseInt(SSMBNO);
	
	WishManager wish = WishManager.getInstance();
	int count = wish.count(ssmbno);
	List<Wish> list = wish.selectList(ssmbno);
%>
<script type="text/javascript">
function wishDelete(gw_no){
	document.wishmove.action = "/wishDelete.do";
	document.wishmove.gw_no.value = gw_no;
	document.wishmove.submit();
}
function goWiew(gs_code){
	document.wishmove.action = "${WEB_ROOT }/goods/goodsView.jsp";
	document.wishmove.gs_code.value = gs_code;
	//document.wishmove.submit();
}
</script>
<c:set var="list" value="<%=list%>" />
<c:set var="count" value="<%=count%>" />
<!--  -->
<p>
<table width="900" align=center cellpadding=0 cellspacing=0>
	<tr>
		<td>
			<div
				style="border:1px solid #ddd; height:34px; background:url(${WEB_ROOT }/img/bbs/title_bg.gif) repeat-x;">
				<div
					style="font-weight: bold; font-size: 14px; margin: 7px 0 0 10px;"
					align="center">::&nbsp;&nbsp;위시 리스트&nbsp;&nbsp;::</div>
			</div>
		</td>
	</tr>
</table>
<p>
	<c:set var="WEB_ROOT" value="/Dmyna" />
<!--  메뉴 -->
<table width="900" border="0" align="center" >
	<tr class="board_list">
		<td colspan="3"></td>
	</tr>
	<tr align="center" bgcolor="" class="board_list">
		<td width="50%">상품명</td>
		<td width="25%">상품단가</td>
		<td width="25%"></td>
	</tr>
</table>

<!-- 찜한 물품이 없을때 보여줄 화면 -->
<c:if test="${empty list}">
	<table width="900" border="0" align="center">
		<tr bgcolor="#f0f0f0">
			<td colspan="5" height="100" align="center">위시 리스트가 없습니다.</td>
		</tr>
	</table>
<!--  -->
</c:if>
<!--  찜한 물건이 있을때 보여줄 화면 -->
<c:if test="${!empty list}">
<c:set var="formCnt" value="0" />
<table width="900" border="0" align="center">
<c:forEach var="writing" items="${list}">
<c:set var="formCnt" value="${formCnt+1 }"/>
	<tr align="center" bgcolor="#f0f0f0">
		<td>
		<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr align="center" class="topline">
				<td  width="50%" align="center"><a href="javascript:goView('${writing.gs_code }')">${writing.gs_name}</a></td>
				<td  width="25%" align="center"><fmt:formatNumber value="${writing.gs_org_price}" type="number"/>원</td>
				<td  width="25%" align="center">
				<input type="button" value="&nbsp;&nbsp;삭&nbsp;제&nbsp;&nbsp;" onclick="wishDelete('${writing.gw_no}')"/></td>
			</tr>
		</table>
	</td>
	</tr>
	</c:forEach>
</table>
</c:if>
<!-- 건수 보여주기 -->
<c:if test="${count >= 1}">
<table width="900" border="0" align="center">
<tr class="board_list">
	<td align="left"><font color="blue">${sessionScope.SESSION_MB_NAME}</font>님께서 ${count}개의 물건을 찜하셨습니다.</td>
</tr>
</table>
</c:if>
<br><br>
<!-- 삭제 -->
<script language="JavaScript">
	function goView(gscode) {
		document.wishmove.action = "${WEB_ROOT }/goods/goodsView.jsp";
		document.wishmove.GS_CODE.value = gscode;
		document.wishmove.submit();
	}
</script>
<!--  -->
<form name="wishmove" method="post">
<input type="hidden" name="GS_CODE" value="" /> 
<input type="hidden" name="gw_no" value="" />
<input type="hidden" name="gs_code" value="" />
</form>
<!--  -->
<%@ include file="/Dmyna/tail.jsp"%>